﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>社员一览</title>
    <link href="~/Content/css/layui.css" rel="stylesheet" />
</head>
<body>
    <div class="main layui-clear">
        <div class="layui-form layui-form-pane">
            <input type="hidden" id="dep" />
            <div class="wrap">
                <table id="users" lay-filter="users"></table>
            </div>
        </div>
    </div>
</body>
</html>
<script type="text/html" id="StaffNoTpl">
    <a href="#" class="layui-table-link" lay-event="sno">{{d.Id || ''}}</a>
</script>
<script src="~/Content/layui.js"></script>
<script>
    layui.use(['jquery', 'table'], function () {
        var $ = layui.jquery;
        var table = layui.table;
        table.render({
            elem: '#users'
            , height: 400
            , width :380
            , title: '社员一览'
            , url: '/Account/UserList?dep=' + $("#dep").val()
            , autoSort: false
            , cols: [[
                { type: 'numbers' }
                , { field: 'Id', title: '工号', width: 100, templet: '#StaffNoTpl' }
                , { field: 'StaffName', title: '姓名', width: 120 }
                , { field: 'Depart', title: '所属部门', width: 90 ,hide:true}
                , { field: 'DepartName', title: '所属部门', width: 90 }
            ]]
        });

        table.on('tool(users)', function (obj) {
            var data = obj.data;
            if (obj.event === 'sno') {
                $('#No', parent.document).val(data.Id);
                $('#StaffName', parent.document).val(data.StaffName);
                $('#Depart', parent.document).val(data.Depart);
                parent.layer.close(parent.layer.getFrameIndex(window.name));
            }
        });

    });
    function child(dep) {
        document.getElementById("dep").value = dep;
    }
</script>